<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => {
        assert_not_equals(window.internals, undefined,
            'This test requires window.internals');
        ['mac', 'win', 'unix', 'android'].forEach(platform => {
            internals.settings.setEditingBehavior(platform);
            assert_selection(
                '<div contenteditable style="white-space:pre;">foo\n|bar\nbaz</div>',
                'delete',
                '<div contenteditable style="white-space:pre;">foo|bar\nbaz</div>',
                `${platform}: delete paragaph`);

            assert_selection(
                '<div contenteditable style="white-space:pre;">foo\n|bar\nbaz</div>',
                selection => {
                    selection.document.execCommand('delete');
                    selection.document.execCommand('undo');
                },
                [
                    '<div contenteditable style="white-space:pre;">',
                        platform === 'mac'
                            ? 'foo|\n^bar\nbaz'
                            : 'foo\n|bar\nbaz',
                    '</div>',
                ].join(''),
                `${platform}: undo after delete paragaph`);
        });
    });
</script>
